package com.daffodil.flowable.entity;

import java.util.Date;

import org.flowable.engine.history.HistoricProcessInstance;

import com.daffodil.core.entity.BaseEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 历史流程信息
 * @author yweijian
 * @date 2021年11月16日
 * @version 1.0
 * @description
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ActCnHistoricProcess extends BaseEntity<String>{

    private static final long serialVersionUID = -8476824391835229207L;

    private String id;
    
    /** 任务名称 */
    private String name;

    /** 任务描述 */
    private String description;

    /** 业务ID */
    private String businessKey;

    /** 流程发起人 */
    private String startUserId;

    /** 所属流程部署ID */
    private String deployId;

    /** 所属租户ID */
    private String tenantId;

    /** 流程实例ID */
    private String processId;

    /** 流程实例名称 */
    private String processName;

    /** 流程实例标识 */
    private String processKey;

    /** 流程实例版本 */
    private Integer processVersion;

    /** 任务开始时间 */
    private Date startTime;

    /** 任务结束时间 */
    private Date endTime;

    /** 任务状态（0在办 1已办结 2已删除） */
    private String status;

    /** 删除原因 */
    private String deleteReason;
    
    /** 回调标识，一般即为JQuery函数名称 */
    private String callbackId;
    
    /** 回调类型，默认为JQueryFunction */
    private String callbackType;

    public ActCnHistoricProcess() {
        super();
    }

    /**
     * 打包封装流程任务对象
     * @return
     */
    public ActCnHistoricProcess(HistoricProcessInstance hpi){
        this.id = hpi.getId();
        this.name = hpi.getName();
        this.description = hpi.getDescription();
        this.businessKey = hpi.getBusinessKey();
        this.startUserId = hpi.getStartUserId();
        this.deployId = hpi.getDeploymentId();
        this.tenantId = hpi.getTenantId();
        this.processId = hpi.getProcessDefinitionId();
        this.processKey = hpi.getProcessDefinitionKey();
        this.processName = hpi.getProcessDefinitionName();
        this.processVersion = hpi.getProcessDefinitionVersion();
        this.startTime = hpi.getStartTime();
        this.endTime = hpi.getEndTime();
        this.deleteReason = hpi.getDeleteReason();
        this.callbackId = hpi.getCallbackId();
        this.callbackType = hpi.getCallbackType();
    }
}
